package com.xueyi.workflow.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.xueyi.common.core.web.entity.base.BaseEntity;
import lombok.Data;

import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 流程实例对象 wf_process_instance
 *
 * @author xueyi
 * @date 2024-07-03
 */
@Data
@TableName(value = "wf_process_instance", excludeProperty = {"name"}, autoResultMap = true)
public class WfProcessInstance extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * Flowable流程实例ID
     */
    private String processInstanceId;

    /**
     * 流程定义ID
     */
    private Long processId;

    /**
     * 流程定义Key
     */
    private String processKey;

    /**
     * 流程名称
     */
    private String processName;

    /**
     * 流程版本号
     */
    private Integer processVersion;

    /**
     * 业务Key
     */
    private String businessKey;

    /**
     * 发起人
     */
    private String initiator;

    /**
     * 状态：RUNNING/COMPLETED/SUSPENDED/TERMINATED
     */
    private String status;

    /**
     * 开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime endTime;

    /**
     * 持续时间(毫秒)
     */
    private Long duration;

    /**
     * 多租户ID
     */
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Long tenantId;

    /**
     * 表单数据（JSON格式）
     */
    private String formData;

    /**
     * 人员配置（JSON格式）
     */
    private String assigneeConfig;

    /**
     * 流程变量（JSON格式）
     */
    private String variables;
}
